
<template>
  <div>
    <HeaderTitle :nologin="nologin" :secondPage="secondPage"></HeaderTitle>
    <logoComponent :secondPage="secondPage"></logoComponent>
    <navComponent v-if="!secondPage"></navComponent>
    <breadcrumbs v-if="this.$route.path != '/' || this.$route.path != '/score' || this.$route.path != '/scoretest'"></breadcrumbs>
    <keep-alive>
      <nuxt-child/>
    </keep-alive>
    <footerComponent></footerComponent>
    <loginRegistered :nologin="nologin" @closedialog="closedialog"></loginRegistered>
  </div>
</template>
<script>
import HeaderTitle from "../components/HeaderTitle";
import logoComponent from "../components/logoComponent";
import navComponent from "../components/navComponent";
import loginRegistered from "../components/loginRegistered";
import footerComponent from "../components/footerComponent";
import breadcrumbs from "../components/breadcrumbs";

import { mapState } from "vuex";
import api from '../static/js/api.js';
var j,s;
var timeoutcon;
var closenum = 0;
export default {
  transition: "test",
  scrollToTop: true,
  components: {
    HeaderTitle,
    logoComponent,
    navComponent,
    loginRegistered,
    footerComponent,
    breadcrumbs
  },
  data(){
    return{
       routerName: [{name:'首页',path:'/'}]
    }
  },
  methods:{
    getUserInfo(){
      if(this.$store.state.nologin){
            //this.$store.state.nologin = true;
            this.$store.state.showlogin = true;
            this.$store.state.userinfo = {};
        }  
    },
    closedialog(){
      closenum ++;
      clearTimeout(timeoutcon)
      this.$store.state.showlogin = false;
      if(closenum == 1){
       timeoutcon = setTimeout(this.getUserInfo, 10000);
      }else if(closenum > 1){
       timeoutcon = setTimeout(this.getUserInfo, 5000);
      }
    }
  },
  computed: {
    ...mapState(["nologin", "secondPage"])
  },
  watch: {
    '$route': function(to, from) {
      clearTimeout(timeoutcon)
       var path = this.$route.path;
       if(path == "/" || path == "/equity" || path == "/trust" || path == "/fund" || path.indexOf("product") != -1){
        if(closenum <= 1){
              timeoutcon = setTimeout(this.getUserInfo, 10000);
          }else if(closenum > 1){
              timeoutcon = setTimeout(this.getUserInfo, 5000);
          }
       }
    }
  },
  mounted: function() {
    clearTimeout(timeoutcon)
    var href = window.location.href;
    if (localStorage.nologin == "false") {
            this.$store.state.nologin = false;
            this.$store.state.showlogin = false;
            this.$store.state.userinfo = JSON.parse(localStorage.userinfo);
    }else{
        if(href.indexOf("research") != -1 || href.indexOf("advisory") != -1 || href.indexOf("web") != -1 || href.indexOf("school") != -1 || href.indexOf("post") != -1 || href.indexOf("about") != -1 || href.indexOf("newslist") != -1){
           
        }else{
           timeoutcon = setTimeout(this.getUserInfo,15000)
        }
    }

    
          window['_MEIQIA'] = window['_MEIQIA'] || function () {
              (window['_MEIQIA'].a = window['_MEIQIA'].a || []).push(arguments)
          };
          j = document.createElement('script'),
          s = document.getElementsByTagName('script')[0];
          j.async = true;
          j.charset = 'UTF-8';
          j.src = 'https://static.meiqia.com/dist/meiqia.js?_=t';
          s.parentNode.insertBefore(j, s);
      
          _MEIQIA('entId', 103141);
          _MEIQIA('withoutBtn');
          _MEIQIA('allSet', function () {
              var __outerBtn = document.getElementById('xxx');
              __outerBtn.onclick = function () {
                  _MEIQIA('showPanel');
              };
          });
  }
};
</script>

<style>
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}
body {
  line-height: 1;
}
ol,
ul {
  list-style: none;
}
blockquote,
q {
  quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
  content: "";
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
body {
  font-family: "Helvetica Neue", Helvetica, Arial, "Hiragino Sans GB",
    "Hiragino Sans GB W3", "Microsoft YaHei UI", "Microsoft YaHei",
    "WenQuanYi Micro Hei", sans-serif;
  font-size: 14px;
  background: #f1f1f1;
  min-width: 1200px;
  margin: 0 auto;
}
.inlin-block {
  display: inline-block;
}
.icon {
   width: 1em; height: 1em;
   vertical-align: -0.15em;
   fill: currentColor;
   overflow: hidden;
}
</style>
